import React from "react";
import { Button, ButtonProps } from 'antd';
import { EditOutlined } from '@ant-design/icons';

import { withModal, mountModal } from "@yaf/pro-ui";

import InitAdmin from "./InitAdmin";

interface InitAdminBtnProps extends ButtonProps{
    accountId: string;
}

const InitAdminBtn: React.FC<InitAdminBtnProps> = ({accountId, size = "small", ...buttonProps}) => {

    return <Button
        icon={<EditOutlined />}
        onClick={() => {
            const InitAdminModal = withModal(InitAdmin);
            mountModal(<InitAdminModal
                modalProps={{
                    title: "初始化管理员",
                    width: "40%",
                }}
                accountId={accountId}
            />);
        }}
        {...buttonProps}
    >初始化管理员</Button>
}

export default InitAdminBtn;
